<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<button>location</button>
		<script type="text/javascript">
			console.log(location.href); //url地址
			console.log(location.host); //主机
			console.log(location.port); //端口
			console.log(location.protocol); //协议

			var button = document.querySelector('button');
			button.addEventListener('click', function() {
				// location.reload();//重新加载
				location.replace("https://www.jd.com");
			})
		</script>
	</body>
</html>
